package com.oauth.auth.controllers;

import javax.servlet.http.HttpServletRequest;

import org.gwtwidgets.server.spring.GWTSpringController;

import com.oauth.auth.client.beans.MemberClientBean;
import com.oauth.auth.client.rpc.MemberRemoteService;
import com.oauth.service.members.beans.Member;

public class MemberController extends GWTSpringController implements MemberRemoteService {
	/**
	 * 
	 */
	private static final long serialVersionUID = -7543496543613271812L;

	public MemberClientBean getMember() {
		HttpServletRequest request = getThreadLocalRequest();
		return getMember(request);
	}

	private MemberClientBean getMember(HttpServletRequest pRequest) {
		Member member = (Member) pRequest.getAttribute("member");
		MemberClientBean memberClient = new MemberClientBean();
		memberClient.setEmail(member.getEmail());
		memberClient.setName(member.getNickName());
		memberClient.setId(member.getMemberId());
		return memberClient;
	}
}
